package com.jd.service.impl;

import com.jd.entity.Book;
import com.jd.mapper.BookMapper;
import com.jd.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ProjectName: soft3->BookServiceImpl
 * Description: 业务层实现类，实现业务层接口，自动装配mapper接口对象
 * Author: 丘丘
 * DateTime: 2024/12/24 21:58
 */

@Service
public class BookServiceImpl implements BookService {
    @Autowired
    private BookMapper bookMapper;
    @Override
    public List<Book> selectAllBooks() {
        return bookMapper.selectAllBooks();
    }

    @Override
    public Book selectBookById(int id) {
        return bookMapper.selectBookById(id);
    }

    @Override
    public Boolean deleteBookById(int id) {
        return bookMapper.deleteBookById(id)>0;
    }

    @Override
    public Boolean insertBook(Book book) {
        return bookMapper.insertBook(book)>0;
    }

    @Override
    public Boolean updateBook(Book book) {
        return bookMapper.updateBook(book)>0;
    }

    @Override
    public List<Book> selectBookByName(String bookName) {
        System.out.println( bookName);
        return bookMapper.selectBookByName(bookName);
    }
}
